package com.gitee.wsl.io.dataproxy

import com.gitee.wsl.ext.base.getValues

interface DataGet<T>:Iterable<T> {

    val size:Int
    val indexes get() = 0..<size

    fun isEmpty(): Boolean = size == 0

    operator fun get(index: Int):T

    fun values(): List<T>

    override fun iterator(): Iterator<T> = values().iterator()

    fun<R> map(block:(T)->R) = values().map(block)

    fun<R> mapIndexed(block:(Int,T)->R) = values().mapIndexed(block)

    fun getIndexes(start:Int, count:Int, step:Int=1) = indexes.getValues(start,count,step)
}


interface DataGetContainer<T>{

    val proxy: DataGet<T>

    //override fun iterator(): Iterator<T> = proxy.iterator()

    companion object

}


